
class StudentManage():
    def __init__(self, students=[]):
        self.students= students
        
    def start(self):
        while True:
            num = self.menu()
            if num == 1:
                self.add_student()
            elif num==2:
                pass
            elif num == 3:
                pass

    def menu(self):
        print("""
            *************************
            *    1: 添加学生        *
            *    2: 删除学生        *
            *    3: 修改学生        *
            *    4: 查询学生信息    *
            *    5: 查询所有学生信息*
            *    6: 保存信息        *
            *    7: 退出系统        *
            *************************
        """)
        num = int(input('请输入功能序号:'))
        return num

    def add_student(self):
        """"添加学生"""
        name = input("name:")
        number = input("number:")
        age = input("age:")
        self.students.append({"name": name, "number": number, "age": age})
        print(f'学生{name} 学号{number} 年龄{age}添加成功')

    def del_student(self):
        a = input("number:")
        student = self.is_exist(a)
        if student:
            self.students.remove(student)
        else:
            print("该学生不存在")

    def is_exist(self, number):
        for i in self.students:
            if i["number"] == number:
                return i
